package com.xywy.beautyand.fragment;

import java.util.ArrayList;
import java.util.List;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ListView;

import com.xywy.beautyand.R;
import com.xywy.beautyand.ACT.AskQuestionAct;
import com.xywy.beautyand.ADAPTER.QuestionListAdapter;
import com.xywy.beautyand.base.BaseFragment;
import com.xywy.beautyand.bean.QuestionList;

public class SumQuestionTypeFrag extends BaseFragment {

	private ListView mylistview;
	private List<QuestionList> list;
	private QuestionListAdapter adapter;

	private FrameLayout seek_frame;
	private FrameLayout back_top;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.frag_sum_question_type, null);
		list = new ArrayList<QuestionList>();
		QuestionList questionList=new QuestionList();
		for (int i = 0; i < 10; i++) {
			list.add(questionList);
		}
		initView(view);
		initListener();
		initdata();
		return view;

	}

	private void initView(View view) {
		mylistview = (ListView) view.findViewById(R.id.mylistview);
		adapter = new QuestionListAdapter(getActivity(), list);
		mylistview.setAdapter(adapter);

		seek_frame = (FrameLayout) view.findViewById(R.id.seek_frame);
		back_top = (FrameLayout) view.findViewById(R.id.back_top);
	}

	private void initListener() {

		seek_frame.setOnClickListener(this);
		back_top.setOnClickListener(this);
	}

	private void initdata() {

	}

	@Override
	public void onClick(View v) {
		super.onClick(v);
		switch (v.getId()) {
		case R.id.seek_frame:
			Intent intent = new Intent(getActivity(), AskQuestionAct.class);
			startActivity(intent);
			break;
		case R.id.back_top:
//			UIUtil.showToast(getActivity(), "暂未实现");
			mylistview.setSelection(0);
			break;

		default:
			break;
		}
	}
}
